import request from '@/utils/request'

// 分页查询直播数据
export function pageLiveRoom(qurey) {
  return request({
    url: '/user/liveRoom/paging',
    method: 'get',
    params: qurey
  })
}

// 统计直播间效益数据
export function countLiveRoomLog(enterpriseId) {
  return request({
    url: '/user/liveRoom/countLiveRoomLog',
    method: 'get',
    params: { enterpriseId }
  })
}

// 同步直播间
export function saveSynchronization(currentPage, size, enterpriseId) {
  return request({
    url: '/user/liveRoom/saveSynchronization',
    method: 'post',
    params: { currentPage: currentPage, size: size, enterpriseId: enterpriseId }
  })
}

// 微信小程序直播明细分页查询
export function pagingLiveDetail(qurey) {
  return request({
    url: '/user/liveRoom/pagingLiveDetail',
    method: 'get',
    params: qurey
  })
}

/**
 * 获取信息
 * @param memberId
 */
export function getLiveRoom(liveRoomId) {
  return request({
    url: '/user/liveRoom/getLiveRoom',
    method: 'get',
    params: { liveRoomId }
  })
}

// 新增或更新直播间信息，不含直播间商品
export function saveLiveRoom(liveRoomDTO) {
  return request({
    url: '/user/liveRoom/saveLiveRoom',
    method: 'post',
    data: liveRoomDTO
  })
}

// 新增直播间，含直播间商品
export function addLiveRoom(liveRoomDTO) {
  return request({
    url: '/user/liveRoom/addLiveRoom',
    method: 'post',
    data: liveRoomDTO
  })
}

/**
 * 移除所有非默认店
 * @param memberId
 */
export function deleteByLiveRoomId(liveRoomId) {
  return request({
    url: '/user/liveRoomMember/deleteByLiveRoomId',
    method: 'post',
    params: { liveRoomId }
  })
}

/**
 * 批量添加可观看直播的店
 * @param memberId
 */
export function saveBatchByLiveRoomId(memberIds, liveRoomId) {
  return request({
    url: '/user/liveRoomMember/saveBatchByLiveRoomId',
    method: 'post',
    params: { memberIds: memberIds, liveRoomId: liveRoomId }
  })
}

// 企业店主分页
export function pagingMember(qurey) {
  return request({
    url: '/user/liveRoomMember/pagingMember',
    method: 'get',
    params: qurey
  })
}

// 直播间观看权限集合
export function listLiveRoomMember(liveRoomId) {
  return request({
    url: '/user/liveRoomMember/listLiveRoomMember',
    method: 'get',
    params: { liveRoomId: liveRoomId }
  })
}

// 删除
export function deleteByRoomMemberId(roomMemberId) {
  return request({
    url: '/user/liveRoomMember/delete',
    method: 'get',
    params: { roomMemberId: roomMemberId }
  })
}

// 查询直播日志数据
export function pagingRaking(qurey) {
  return request({
    url: '/user/liveRoomLog/pagingRaking',
    method: 'get',
    params: qurey
  })
}

// 查询直播日志数据
export function countLiveOrder(roomId, enterpriseId) {
  return request({
    url: '/user/liveRoomLog/countLiveOrder',
    method: 'get',
    params: { roomId: roomId, enterpriseId: enterpriseId }
  })
}

// 直播间商品分页
export function pagingLiveRoomGoods(params) {
  return request({
    url: '/user/liveRoom/pagingLiveRoomGoods',
    method: 'get',
    params
  })
}

// 往指定直播间导入已入库商品
export function addLiveRoomGoods(liveRoom) {
  return request({
    url: '/user/liveRoom/addLiveRoomGoods',
    method: 'post',
    data: liveRoom
  })
}

// 上下架商品
export function updateLiveRoomGoods(liveRoomGoods) {
  return request({
    url: '/user/liveRoom/updateLiveRoomGoods',
    method: 'post',
    params: liveRoomGoods
  })
}

// 删除直播间商品
export function deleteLiveRoomGoods(liveRoomGoods) {
  return request({
    url: '/user/liveRoom/deleteLiveRoomGoods',
    method: 'post',
    params: liveRoomGoods
  })
}
